package com.创建方式二实现Runnable.匿名内部类写法;

public class RunnableDemo02 {
    /*
    匿名内部类可以用lambda表达式简化
     */
    public static void main(String[] args) {
        Runnable runnable =()-> {
            for (int i = 0; i < 100; i++) {
                System.out.println("lambda表达式"+i);
            }
        };

        //任务对象转换成多线程启动类对象
        new Thread(runnable).start();

        for (int i = 0; i < 100; i++) {
            System.out.println("主线程"+i);
        }
    }
}
